<template>
	<view class="container">
		<view class="box-1" @click="toUserList">
			<view class="user-num">
				<view class="l-text">
					已选择8位用户
				</view>
				<image :src="$img_path('/home/icon-right.png')" mode="widthFix"></image>
			</view>
			<view class="select-time">
				<view class="left">
					<image :src="$img_path('/pagesMine/9.png')" mode="widthFix"></image>
					<text>服务时间</text>
				</view>
				<view class="right">
					<text>05月20日  今天22:00</text>
					<image :src="$img_path('/home/icon-right.png')" mode="widthFix"></image>
				</view>
			</view>
		</view>
		
		<!-- 服务商品信息 -->
		<view class="card-box mt-20 service-goods-info-box" style="margin-top: 20rpx;">
			<view class="service-goods-info-item">
				<view class="service-goods-info-item-image">
					<lazy-image src="/home/goods-col.png"></lazy-image>
				</view>
				<view class="service-goods-info-item-right">
					<view class="goods-info">
						<text>定死服务包名称</text>
						<text class="goods-info-price"><text class="goods-info-price-pre">￥</text>1000</text>
					</view>
					<view class="goods-sku" style="display: flex;justify-content: space-between;align-items: center;">
						<text>规格名称规格名称10次</text>
						
						<text style="color: #B4B4B4;font-size: 28rpx;line-height: 40rpx;">x24</text>
					</view>
				</view>
			</view>
			<view class="gap"></view>
			<view class="row-b service-goods-row-item" @click="gotoBoundDetail">
				<view class="label">
					<text>保险介绍</text>
					<view class="" style="font-size: 28rpx; margin-top: 6rpx;">
						<text>介绍介绍介绍介绍介绍介绍</text>
					</view>
				</view>
				<view class="flex items-center">
					<view class="sub-label" style="color: #999999;">
						免费赠送
					</view>
					<view class="icon-24">
						<image :src="$img_path('/home/icon-right.png')" mode="widthFix"></image>
					</view>
				</view>
			</view>
			<view class="gap"></view>
			<view class="row-b service-goods-row-item">
				<view class="label">
					<text>总费用</text>
				</view>
				<view class="flex items-center">
					<view class="sub-label">
						¥ 20.00
					</view>
				</view>
			</view>
			<view class="gap"></view>
			<view class="row-b service-goods-row-item">
				<view class="label">
					<text>夜间费</text>
				</view>
				<view class="flex items-center">
					<view class="sub-label">
						¥ 20.00
					</view>
				</view>
			</view>
			<view class="gap"></view>
			<view class="row-b service-goods-row-item">
				<view class="label">
					<text>优惠券</text>
				</view>
				<view class="flex items-center" @click="$refs.coupon.open()">
					<view class="sub-label">
						-¥ 20.00
					</view>
					<view class="icon-24">
						<image :src="$img_path('/home/icon-right.png')" mode="widthFix"></image>
					</view>
				</view>
			</view>
		</view>
		<view class="switch-box card-box mt-20 p-20" style="padding: 22rpx 20rpx;margin-top: 20rpx;box-sizing: border-box;">
			<view class="switch-box-title">
				<text>是否有医护服务名称工具？</text>
			</view>
			<view class="switch-box-btns">
				<view 
					class="switch-box-btn" 
					:class="{'common-btn-bg-color switch-box-btn-active': orderFormData.isEh}"
					@click="switchChange(true)"
				>
					<text>有</text>
				</view>
				<view 
					class="switch-box-btn" 
					:class="{'common-btn-bg-color switch-box-btn-active': !orderFormData.isEh}"
					@click="switchChange(false)"
				>
					<text>无</text>
				</view>
			</view>
			<view class="" v-if="!orderFormData.isEh">
				<view class="display-flex space-between alig margin-top-30" v-for="item in 4" @click="gotoServicePackageDetail">
					<view class="display-flex alig" >
						<view class="sex-icon">
							<image v-if="item == 0" :src="$img_path('/course/pay_checkbox1.png')" mode="widthFix"></image>
							<image v-else :src="$img_path('/course/pay_checkbox2.png')" mode="widthFix"></image>
						</view>
						<view style="font-weight: bold;font-size: 30rpx;color: #333333;">
							<text>产品名称产品名称x1（¥ 30.00）</text>
						</view>
					</view>
					<view class="icon-24">
						<image :src="$img_path('/home/icon-right.png')" mode="widthFix"></image>
					</view>
				</view>
			</view>
		</view>
		
		
		
		<view class="bottom-btn">
			<view class="b-box">
				<view class="all-chack">
					<text>￥</text><text>130</text>.00
				</view>
				<button @click="$refs.pay.open()">下单</button>
			</view>
		</view>
		
		
		
		<!-- 优惠券 -->
		<popupBox ref="coupon" type="bottom" :isSlot="true">
			<view class="coupon-popup">
				<view class="title">
					<text>优惠券</text>
					<image :src="$img_path('/course/close_popup.png')" @click="$refs.coupon.close()" mode="widthFix"></image>
				</view>
				<view class="tab">
					<view class="item" :class="coupon_tab==1?'select':''" @click="tabCheck(1)">
						<text>可使用优惠券(2)</text>
					</view>
					<view class="item" :class="coupon_tab==2?'select':''" @click="tabCheck(2)">
						<text>不可使用优惠券(2)</text>
					</view>
				</view>
				<view class="coupon-box">
					<view class="item" v-for="(item,i) in 2" :key="i">
						<image class="bg" :src="$img_path('/course/coupon.png')" mode="scaleToFill"></image>
						<view class="c_num">
							<view class="price">
								<text>￥</text>5
							</view>
							<text>满25可用</text>
						</view>
						<view class="c_info">
							<text class="xz">优惠券名称</text>
							<view class="c_box">
								有效期至2023-08-15 14：00
							</view>
							<view class="time">
								仅限线上课程使用 <image :src="$img_path('/course/coupon_3.png')" mode="widthFix"></image>
							</view>
						</view>
						<image class="checkImg" v-if="false" :src="$img_path('/course/coupon_2.png')" mode="widthFix"></image>
						<image class="checkImg" v-else :src="$img_path('/course/coupon_1.png')" mode="widthFix"></image>
						
						<view class="not_use" v-if="coupon_tab==2">
							<button>不可使用</button>
						</view>
					</view>
				</view>
				<view class="btn">
					<view class="b-box">
						<button v-if="coupon_tab==1">确认</button>
					</view>
				</view>
			</view>
		</popupBox>
		<!-- 支付 -->
		<popupBox ref="pay" type="bottom" :isSlot="true">
			<view class="pay-box">
				<view class="top">
					<image :src="$img_path('/course/close_popup.png')" @click="$refs.pay.close()" mode="widthFix"></image>
				</view>
				<view class="price">
					<view class="num">
						<text>￥</text>80.00
					</view>
				</view>
				<view class="pay-type">
					<view class="item">
						<view class="left">
							<image :src="$img_path('/course/pay_1.png')" mode="widthFix"></image>
							<view class="name">
								<text>微信支付</text>
							</view>
						</view>
						<view class="right">
							<image v-if="false" :src="$img_path('/course/pay_checkbox1.png')" mode="widthFix"></image>
							<image v-else :src="$img_path('/course/pay_checkbox2.png')" mode="widthFix"></image>
						</view>
					</view>
					<view class="item">
						<view class="left">
							<image :src="$img_path('/course/pay_2.png')" mode="widthFix"></image>
							<view class="name">
								<text>第三方支付</text>
							</view>
						</view>
						<view class="right">
							<image v-if="false" :src="$img_path('/course/pay_checkbox1.png')" mode="widthFix"></image>
							<image v-else :src="$img_path('/course/pay_checkbox2.png')" mode="widthFix"></image>
						</view>
					</view>
					<view class="item">
						<view class="left">
							<image :src="$img_path('/course/pay_3.png')" mode="widthFix"></image>
							<view class="name">
								<text>余额</text>
								<text>余额：¥ 500.00</text>
							</view>
						</view>
						<view class="right">
							<image v-if="false" :src="$img_path('/course/pay_checkbox1.png')" mode="widthFix"></image>
							<image v-else :src="$img_path('/course/pay_checkbox2.png')" mode="widthFix"></image>
						</view>
					</view>
				</view>
				
				<view class="btn">
					<view class="b-box">
						<button @click="payOrder">确认支付</button>
					</view>
				</view>
			</view>
		</popupBox>
	</view>
</template>

<script>
	import popupBox from '../../components/popup/popup.vue';
	export default {
		components:{
			popupBox
		},
		data() {
			return {
				coupon_tab:1,
				orderFormData:{
					isEh:false
				}
			};
		},
		methods:{
			
			tabCheck(i){
				this.coupon_tab = i
			},
			payOrder(){
				uni.navigateTo({
					url:'/pagesRegion/majorClients/paysuccess'
				})
			},
			
			switchChange(value) {
				this.orderFormData.isEh = value
			},
			toUserList(){
				uni.navigateTo({
					url:'/pagesRegion/majorClients/userList'
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
.container{
	padding: 0 22rpx;
	box-sizing: border-box;
	.box-1{
		background: #FFFFFF;
		border-radius: 20rpx;
		margin-top: 20rpx;
		.user-num{
			width: 100%;
			height: 198rpx;
			border-bottom: 2rpx solid #F8F8F8;
			display: flex;
			align-items: center;
			justify-content: space-between;
			padding: 0 16rpx;
			box-sizing: border-box;
			.l-text{
				font-weight: bold;
				font-size: 40rpx;
				color: #000000;
				line-height: 56rpx;
			}
			image{
				width: 40rpx;
				height: 40rpx;
			}
		}
		.select-time{
			padding: 30rpx 18rpx 24rpx;
			box-sizing: border-box;
			display: flex;
			align-items: center;
			justify-content: space-between;
			.left{
				display: flex;
				align-items: center;
				image{
					width: 40rpx;
					height: 40rpx;
				}
				
				text{
					font-weight: bold;
					font-size: 30rpx;
					color: #333333;
					line-height: 42rpx;
					margin-left: 24rpx;
				}
			}
			.right{
				display: flex;
				align-items: center;
				text{
					font-weight: 400;
					font-size: 24rpx;
					color: #999999;
					line-height: 34rpx;
				}
				image{
					width: 32rpx;
					height: 32rpx;
				}
			}
		}
	}
}

	.bottom-btn{
		width: 100%;
		height: calc(constant(safe-area-inset-bottom) + 136rpx);
		height: calc(env(safe-area-inset-bottom) + 136rpx);
		
		.b-box{
			position: fixed;
			bottom: 0;
			left: 0;
			right: 0;
			padding: 20rpx 22rpx;
			padding-bottom: calc(constant(safe-area-inset-bottom) + 20rpx);
			padding-bottom: calc(env(safe-area-inset-bottom) + 20rpx);
			box-sizing: border-box;
			display: flex;
			justify-content: space-between;
			align-items: center;
			background-color: #FFFFFF;
			box-shadow: 0rpx -4rpx 8rpx 2rpx rgba(0,0,0,0.05);
			.all-chack{
				font-weight: bold;
				font-size: 28rpx;
				color: #E72A2A;
				line-height: 64rpx;
				text{
					&:nth-child(1){
						font-size: 24rpx;
					}
					&:nth-child(2){
						font-size: 48rpx;
					}
				}
			}
			button{
				width: 276rpx;
				height: 96rpx;
				background: linear-gradient( 90deg, #FFA233 0%, #FB4C4C 100%);
				border-radius: 80rpx;
				font-weight: 400;
				font-size: 36rpx;
				color: #FFFFFF;
				line-height: 96rpx;
			}
		}
	}
@import "confrimOrder.scss";
</style>
